﻿package frEngine.animateControler.particleControler.animate
{
    import __AS3__.vec.*;
    import flash.geom.*;
    import frEngine.animateControler.particleControler.*;

    public class UseLineForce extends Object implements IParticleAnimate
    {
        public var orglineForce:Vector3D;
        public static const instance:UseLineForce = new UseLineForce;

        public function UseLineForce()
        {
            this.orglineForce = new Vector3D();
            return;
        }// end function

        public function get objClass() : Class
        {
            return UseLineForce;
        }// end function

        public function canOpen(param1:ParticleParams) : Boolean
        {
            return param1.useLineForce;
        }// end function

        public function update(param1:ParticleStatus) : void
        {
            var _loc_4:ParticleItem = null;
            var _loc_5:Vector3D = null;
            var _loc_7:int = 0;
            var _loc_2:* = param1.particleList;
            var _loc_3:* = _loc_2.length;
            var _loc_6:int = 0;
            while (_loc_6 < _loc_3)
            {
                
                _loc_4 = _loc_2[_loc_6];
                if (_loc_4.visible && _loc_4.toUpdate)
                {
                    _loc_5 = _loc_4.resultPos;
                    _loc_7 = _loc_4.curFrame;
                    _loc_7 = _loc_7 * (0.5 * _loc_7);
                    _loc_5.x = _loc_5.x + _loc_7 * this.orglineForce.x;
                    _loc_5.y = _loc_5.y + _loc_7 * this.orglineForce.y;
                    _loc_5.z = _loc_5.z + _loc_7 * this.orglineForce.z;
                }
                _loc_6++;
            }
            return;
        }// end function

        public function init(param1:ParticleStatus, param2:ParticleParams) : void
        {
            var _loc_3:* = param2.lineForceVecor3d;
            this.orglineForce.x = _loc_3.x * _loc_3.w;
            this.orglineForce.y = _loc_3.y * _loc_3.w;
            this.orglineForce.z = _loc_3.z * _loc_3.w;
            return;
        }// end function

    }
}
